<?php
include_once("functions.php");
$statePostUserHead = $thistimeline["user"]["profile_image_url"];
$statePostUserName = $thistimeline["user"]["screen_name"];
$statePostUserUid = $thistimeline["user"]["id"];
$statePostUserName = $statePostUserName?$statePostUserName:$statePostUserUid;
$statePostId = $thistimeline["id"];
$statePostTime = $thistimeline["created_at"];
$statePostSource = $thistimeline["source"];
$statePostText = $thistimeline["text"];
$statePostImage = $thistimeline["bmiddle_pic"];
$statePostRetweet = $thistimeline["retweeted_status"];
?>
<div <?php if($cachedPost){ ?>class="statePost cachedWeibo"<?php }else{ ?>class="statePost"<?php }?>>
<div class="stateUserHead" style="background: url(<?php echo $_SERVER['HTTPS']?"/qsimg/".base64_encode($statePostUserHead):$statePostUserHead; ?>)">
</div>
<div class="statePostContent">
<div class="statePostTrig"></div>
<div class="statePostInfo"><span class="statePostUserName"><a href="/user/<?php echo $statePostUserName; ?>"><?php echo $statePostUserName; ?></a></span> - <?php echo formatTime($statePostTime); ?> - 来自<?php echo $statePostSource; ?></div><?php if($thistimeline["reposts_count"]){?><div class="repostCount">- <?php echo $thistimeline["reposts_count"]; ?></div><?php } ?><div style="clear: both"></div>
<div class="statePostWords">
<div>
<?php
echo format($statePostText);
?>

<?php if(!$statePostRetweet && $musicUrl = getMusicUrl($statePostText)){ ?>
<div id="music-<?php echo $statePostId; ?>" style="margin: 10px 0px; padding: 3px;">
<embed height="33" width="257" wmode="transparent" type="application/x-shockwave-flash" src="<?php echo $musicUrl; ?>"></embed>
</div>
<?php } ?>

<?php if($statePostImage){ ?>
<div class="statePostImageOuter"><img onclick="showImage('<?php echo $thistimeline["original_pic"]; ?>');" class="statePostImage" src="<?php echo $_SERVER['HTTPS']?"/qsimg/".base64_encode($statePostImage):$statePostImage; ?>"></div>
<?php } ?>

<?php if(!$statePostRetweet && $videoUrl = getVideoUrl($statePostText)){ ?>
<div class="videoDiv">
<div id="svideo-<?php echo $statePostId; ?>" class="videoAction" onclick="showVideo('video-<?php echo $statePostId; ?>',this,'cvideo-<?php echo $statePostId; ?>');"><?php echo $videoUrl[1]; ?></div>
<div id="video-<?php echo $statePostId; ?>" style="display: none; position: relative;"><div id="cvideo-<?php echo $statePostId; ?>" class="videoClose" onclick="closeVideo('video-<?php echo $statePostId; ?>', 'svideo-<?php echo $statePostId; ?>')"><a href="javascript:void(0)">收起</a></div>
<embed src="<?php echo $videoUrl[0]; ?>" allowFullScreen="true" quality="high" width="480" height="400" wmode="transparent" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" allowNetworking="all" allowScriptAccess="always"></embed>
</div>
</div>
<?php } ?>

<?php if($statePostRetweet){ ?>
<? if(!$statePostRetweet["user"]["id"] && ($cache = getCache($statePostRetweet["id"]))){$statePostRetweet = $cache; $cached = true;}else{$cached = false;} ?>
<div <?php if($cached){ ?>class="stateRepost cachedWeibo"<?php }else{ ?>class="stateRepost"<?php }?>>
<?php
$statePostRetweetUserName = $statePostRetweet["user"]["screen_name"];
$statePostRetweetUserId = $statePostRetweet["user"]["id"];
$statePostRetweetUserName = $statePostRetweetUserName?$statePostRetweetUserName:$statePostRetweetUserId;
?>
<?php if($statePostRetweet["user"]["id"]){ ?>
<div class="statePostInfo"><span class="statePostUserName"><a href="/user/<?php echo $statePostRetweetUserName; ?>"><?php echo $statePostRetweetUserName; ?></a></span> - <a href="/post/<?php echo $statePostRetweet["id"]; ?>"><?php echo formatTime($statePostRetweet["created_at"]); ?></a> - 来自<?php echo $statePostRetweet["source"]; ?></div><?php if($statePostRetweet["reposts_count"]){?><div class="repostCount"> - <?php echo $statePostRetweet["reposts_count"]; ?></div><?php } ?><div style="clear: both"></div>
<?php
}
$statePostText = $statePostRetweet["text"];
echo format($statePostText);
?>

<?php if($musicUrl = getMusicUrl($statePostText)){ ?>
<div id="rmusic-<?php echo $statePostId; ?>" style="margin: 10px 0px; padding: 3px;">
<embed height="33" width="257" wmode="transparent" type="application/x-shockwave-flash" src="<?php echo $musicUrl; ?>"></embed>
</div>
<?php } ?>

<?php if($statePostRetweet["bmiddle_pic"]){ ?>
<div class="statePostImageOuter"><img onclick="showImage('<?php echo $statePostRetweet["original_pic"]; ?>');" class="statePostImage" src="<?php echo $_SERVER['HTTPS']?"/qsimg/".base64_encode($statePostRetweet["bmiddle_pic"]):$statePostRetweet["bmiddle_pic"]; ?>"></div>
<?php } ?>

<?php if($videoUrl = getVideoUrl($statePostText)){ ?>
<div class="videoDiv">
<div id="rsvideo-<?php echo $statePostId; ?>" class="videoAction" onclick="showVideo('rvideo-<?php echo $statePostId; ?>',this,'rvideo-<?php echo $statePostId; ?>');"><?php echo $videoUrl[1]; ?></div>
<div id="rvideo-<?php echo $statePostId; ?>" style="display: none; position: relative;"><div id="rcvideo-<?php echo $statePostId; ?>" class="videoClose" onclick="closeVideo('rvideo-<?php echo $statePostId; ?>', 'rsvideo-<?php echo $statePostId; ?>')"><a href="javascript:void(0)">收起</a></div>
<embed src="<?php echo $videoUrl[0]; ?>" allowFullScreen="true" quality="high" width="480" height="400" wmode="transparent" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" allowNetworking="all" allowScriptAccess="always"></embed>
</div>
</div>
<?php } ?>

</div>
<?php } ?>
</div>
<div id="comments" class="statePostActions"><a href="#" onclick="showPublishBox('<?php echo $statePostId; ?>', '<?php echo $statePostRetweet?("//@".$statePostUserName.": ".$statePostTextO):""; ?>');return false;">转发</a> - <a href="##" onclick="addFavorites('<?php echo $statePostId; ?>');return false;">收藏</a> - <a href="#" onclick="document.getElementById('commentbox-<?php echo $statePostId; ?>').focus();return false;">评论</a><?php if($statePostUserUid == $uid){ ?> - <a href="##" onclick="deletePost('<?php echo $statePostId; ?>',1);return false;">删除</a><? } ?></div>
<div style="display: block;" class="statePostCommentBoxDiv">
<div>
<div class="statePostCommentBox">
<div id="commentid-<?php echo $statePostId; ?>" style="visibility: hidden; height: 0;"></div>
<table>
<tr>
<td class="statePostCommentBoxReplay" id="replaybox-<?php echo $statePostId; ?>"></td>
<td class="statePostCommentInnerBox"><input type="text" id="commentbox-<?php echo $statePostId; ?>" onfocus="if(this.value == '添加评论'){this.value='';this.style.color='#000000';}" onblur="if(this.value==''){this.style.color='#888888';this.value='添加评论'};" onkeydown="if(event.keyCode==13){return false;}" class="statePostCommentInnerInput" value="添加评论" /></td>
</tr>
</table>
</div>
<div class="statePostCommentButton" onclick="replaynew('<?php echo $statePostId; ?>', document.getElementById('commentbox-<?php echo $statePostId; ?>').value, document.getElementById('commentid-<?php echo $statePostId; ?>').innerHTML, 1, 'comment', 0);document.getElementById('commentbox-<?php echo $statePostId; ?>').style.color='#888888';document.getElementById('commentbox-<?php echo $statePostId; ?>').value='添加评论';document.getElementById('commentid-<?php echo $statePostId; ?>').innerHTML='';document.getElementById('replaybox-<?php echo $statePostId; ?>').style.display='none';document.getElementById('replaybox-<?php echo $statePostId; ?>').innerHTML='';">评　论</div>
<div class="floatClear"></div>
</div>
<div style="display: block;" id="comment">
<?php
include_once("comments.php");
?>
</div>
</div>
</div>
</div>
<div class="floatClear"></div>
</div>